```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构型设计模式解析 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .code-block {
            background-color: #282c34;
            border-left: 4px solid #667eea;
        }
        .pattern-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .hover-scale {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .hover-scale:hover {
            transform: scale(1.02);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col items-center text-center">
                <h1 class="serif text-4xl md:text-5xl font-bold mb-6 leading-tight">
                    结构型设计模式解析
                </h1>
                <p class="text-xl md:text-2xl max-w-3xl opacity-90 mb-8">
                    探索装饰器、适配器、代理和桥接模式的艺术，构建灵活可扩展的代码架构
                </p>
                <div class="flex space-x-4">
                    <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full flex items-center">
                        <i class="fas fa-code mr-2"></i> 设计模式
                    </span>
                    <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full flex items-center">
                        <i class="fas fa-project-diagram mr-2"></i> 软件架构
                    </span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <h2 class="serif text-3xl font-bold mb-6 text-gray-800">结构型设计模式概述</h2>
                    <p class="text-gray-700 mb-6 text-lg leading-relaxed">
                        结构型设计模式关注如何组合类和对象以形成更大的结构。它们通过继承或组合机制来组合接口或实现，帮助我们构建灵活且可扩展的代码架构。
                    </p>
                    <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded">
                        <p class="text-blue-800 flex items-start">
                            <i class="fas fa-lightbulb text-blue-500 mt-1 mr-3"></i>
                            <span>结构型模式的核心在于：通过组合对象来获得新功能，而不是通过继承。这遵循了"组合优于继承"的设计原则。</span>
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Patterns Overview -->
        <section class="mb-16">
            <h2 class="serif text-3xl font-bold mb-8 text-gray-800 text-center">四种核心结构型模式</h2>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                <!-- Decorator Card -->
                <div class="pattern-card bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
                                <i class="fas fa-layer-group text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="serif text-2xl font-bold text-gray-800">装饰器模式</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            动态地为对象添加额外功能，而不影响其他对象。通过创建装饰器类来包装原始对象，实现功能的灵活扩展。
                        </p>
                        <div class="flex flex-wrap gap-2 mb-4">
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">动态扩展</span>
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">运行时添加功能</span>
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">组合优于继承</span>
                        </div>
                        <a href="#decorator" class="text-purple-600 font-medium inline-flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- Adapter Card -->
                <div class="pattern-card bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-lg bg-blue-100 flex items-center justify-center mr-4">
                                <i class="fas fa-exchange-alt text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="serif text-2xl font-bold text-gray-800">适配器模式</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            将不兼容的接口转换为兼容的接口，使原本无法一起工作的类能够协同工作。就像现实中的电源适配器一样。
                        </p>
                        <div class="flex flex-wrap gap-2 mb-4">
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">接口转换</span>
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">兼容性</span>
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">封装变化</span>
                        </div>
                        <a href="#adapter" class="text-blue-600 font-medium inline-flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- Proxy Card -->
                <div class="pattern-card bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-lg bg-green-100 flex items-center justify-center mr-4">
                                <i class="fas fa-shield-alt text-green-600 text-xl"></i>
                            </div>
                            <h3 class="serif text-2xl font-bold text-gray-800">代理模式</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            为其他对象提供一种代理以控制对这个对象的访问。可以在访问对象前后添加额外操作，如权限检查、缓存等。
                        </p>
                        <div class="flex flex-wrap gap-2 mb-4">
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">访问控制</span>
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">延迟初始化</span>
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">增强功能</span>
                        </div>
                        <a href="#proxy" class="text-green-600 font-medium inline-flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- Bridge Card -->
                <div class="pattern-card bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="w-12 h-12 rounded-lg bg-indigo-100 flex items-center justify-center mr-4">
                                <i class="fas fa-bridge text-indigo-600 text-xl"></i>
                            </div>
                            <h3 class="serif text-2xl font-bold text-gray-800">桥接模式</h3>
                        </div>
                        <p class="text-gray-600 mb-4">
                            将抽象部分与实现部分分离，使它们可以独立变化。通过组合而非继承来连接抽象和实现，解决多层次继承带来的问题。
                        </p>
                        <div class="flex flex-wrap gap-2 mb-4">
                            <span class="px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm">分离抽象</span>
                            <span class="px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm">独立变化</span>
                            <span class="px-3 py-1 bg-indigo-100 text-indigo-800 rounded-full text-sm">解耦合</span>
                        </div>
                        <a href="#bridge" class="text-indigo-600 font-medium inline-flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <h2 class="serif text-3xl font-bold mb-6 text-gray-800">结构型模式关系图</h2>
                    <div class="bg-gray-50 p-6 rounded-lg">
                        <div class="mermaid">
                            graph TD
                                A[结构型模式] --> B[装饰器模式]
                                A --> C[适配器模式]
                                A --> D[代理模式]
                                A --> E[桥接模式]
                                
                                B -->|动态添加功能| F((灵活性))
                                C -->|接口转换| G((兼容性))
                                D -->|访问控制| H((安全性))
                                E -->|分离抽象| I((可扩展性))
                                
                                style A fill:#f0f9ff,stroke:#2563eb,stroke-width:2px
                                style B fill:#f5f3ff,stroke:#7c3aed
                                style C fill:#eff6ff,stroke:#3b82f6
                                style D fill:#ecfdf5,stroke:#10b981
                                style E fill:#eef2ff,stroke:#6366f1
                        </div>
                    </div>
                    <div class="mt-6 text-gray-600">
                        <p class="mb-4">这张关系图展示了四种结构型设计模式及其带来的核心价值。每种模式解决不同层面的结构问题，但它们共同的目标都是提升代码的灵活性和可维护性。</p>
                        <ul class="list-disc pl-5 space-y-2">
                            <li><span class="font-medium">装饰器模式</span>通过动态包装对象来扩展功能</li>
                            <li><span class="font-medium">适配器模式</span>作为两个不兼容接口之间的桥梁</li>
                            <li><span class="font-medium">代理模式</span>控制对原始对象的访问</li>
                            <li><span class="font-medium">桥接模式</span>将抽象与实现分离以实现独立变化</li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- Decorator Pattern -->
        <section id="decorator" class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-14 h-14 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
                            <i class="fas fa-layer-group text-purple-600 text-2xl"></i>
                        </div>
                        <h2 class="serif text-3xl font-bold text-gray-800">装饰器模式 (Decorator Pattern)</h2>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">核心概念</h3>
                            <p class="text-gray-700 mb-4">
                                装饰器模式允许向一个现有的对象添加新的功能，同时又不改变其结构。这种模式创建了一个装饰类，用来包装原有的类，提供了比继承更有弹性的替代方案。
                            </p>
                            <div class="bg-purple-50 border-l-4 border-purple-500 p-4 rounded mb-6">
                                <p class="text-purple-800">
                                    <span class="font-semibold">适用场景：</span>当你需要在不修改现有代码的情况下，动态地为对象添加新功能时。例如：GUI工具包中的滚动条、边框等装饰，或者I/O流处理中的缓冲、压缩等功能。
                                </p>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">优缺点</h3>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <h4 class="font-medium text-green-800 mb-2 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </h4>
                                    <ul class="list-disc pl-5 text-sm text-green-700">
                                        <li>比继承更灵活</li>
                                        <li>动态添加/删除功能</li>
                                        <li>符合开闭原则</li>
                                    </ul>
                                </div>
                                <div class="bg-red-50 p-4 rounded-lg">
                                    <h4 class="font-medium text-red-800 mb-2 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </h4>
                                    <ul class="list-disc pl-5 text-sm text-red-700">
                                        <li>可能产生大量小类</li>
                                        <li>调试复杂度增加</li>
                                        <li>多层装饰增加理解难度</li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">代码示例</h3>
                            <div class="code-block rounded-lg overflow-hidden mb-4">
                                <pre class="text-gray-200 p-4 text-sm overflow-x-auto">
                                    <code>
// 组件接口
public interface Coffee {
    String getDescription();
    double cost();
}

// 具体组件
public class SimpleCoffee implements Coffee {
    public String getDescription() {
        return "Simple Coffee";
    }
    public double cost() {
        return 5.0;
    }
}

// 装饰器
public abstract class CoffeeDecorator implements Coffee {
    protected Coffee decoratedCoffee;
    public CoffeeDecorator(Coffee coffee) {
        this.decoratedCoffee = coffee;
    }
    public String getDescription() {
        return decoratedCoffee.getDescription();
    }
    public double cost() {
        return decoratedCoffee.cost();
    }
}

// 具体装饰器
public class MilkDecorator extends CoffeeDecorator {
    public MilkDecorator(Coffee coffee) {
        super(coffee);
    }
    public String getDescription() {
        return super.getDescription() + ", Milk";
    }
    public double cost() {
        return super.cost() + 1.0;
    }
}
                                    </code>
                                </pre>
                            </div>
                            <div class="flex items-center text-gray-600 text-sm">
                                <i class="fas fa-info-circle mr-2 text-purple-500"></i>
                                <span>客户端可以自由组合基础组件和各种装饰器，动态地创建所需功能的对象。</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Adapter Pattern -->
        <section id="adapter" class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-14 h-14 rounded-lg bg-blue-100 flex items-center justify-center mr-4">
                            <i class="fas fa-exchange-alt text-blue-600 text-2xl"></i>
                        </div>
                        <h2 class="serif text-3xl font-bold text-gray-800">适配器模式 (Adapter Pattern)</h2>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">核心概念</h3>
                            <p class="text-gray-700 mb-4">
                                适配器模式将一个类的接口转换成客户期望的另一个接口，使得原本由于接口不兼容而不能一起工作的类可以一起工作。它就像现实世界中的转接头或适配器。
                            </p>
                            <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded mb-6">
                                <p class="text-blue-800">
                                    <span class="font-semibold">适用场景：</span>当你需要使用现有的类，但其接口与你的需求不匹配时；或者当你想要创建一个可重用的类，与不相关或不可预见的类协同工作。
                                </p>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">实现方式</h3>
                            <div class="mb-6">
                                <div class="flex items-start mb-3">
                                    <div class="bg-blue-100 text-blue-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">1</div>
                                    <p class="text-gray-700">定义客户端期望的接口（目标接口）</p>
                                </div>
                                <div class="flex items-start mb-3">
                                    <div class="bg-blue-100 text-blue-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">2</div>
                                    <p class="text-gray-700">创建适配器类实现目标接口</p>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-blue-100 text-blue-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">3</div>
                                    <p class="text-gray-700">在适配器类中包装被适配者的实例，并在目标接口方法中调用被适配者的方法</p>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">代码示例</h3>
                            <div class="code-block rounded-lg overflow-hidden mb-4">
                                <pre class="text-gray-200 p-4 text-sm overflow-x-auto">
                                    <code>
// 目标接口
public interface Target {
    void request();
}

// 被适配的类
public class Adaptee {
    public void specificRequest() {
        System.out.println("Specific request");
    }
}

// 适配器类
public class Adapter implements Target {
    private Adaptee adaptee;
    public Adapter(Adaptee adaptee) {
        this.adaptee = adaptee;
    }
    public void request() {
        adaptee.specificRequest();
    }
}
                                    </code>
                                </pre>
                            </div>
                            <div class="flex items-center text-gray-600 text-sm">
                                <i class="fas fa-info-circle mr-2 text-blue-500"></i>
                                <span>适配器模式有两种类型：对象适配器（使用组合）和类适配器（使用多重继承）。Java中通常使用对象适配器。</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Proxy Pattern -->
        <section id="proxy" class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-14 h-14 rounded-lg bg-green-100 flex items-center justify-center mr-4">
                            <i class="fas fa-shield-alt text-green-600 text-2xl"></i>
                        </div>
                        <h2 class="serif text-3xl font-bold text-gray-800">代理模式 (Proxy Pattern)</h2>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">核心概念</h3>
                            <p class="text-gray-700 mb-4">
                                代理模式为其他对象提供一种代理以控制对这个对象的访问。代理对象可以在客户端和目标对象之间起到中介的作用，并且可以增加额外的功能。
                            </p>
                            <div class="bg-green-50 border-l-4 border-green-500 p-4 rounded mb-6">
                                <p class="text-green-800">
                                    <span class="font-semibold">适用场景：</span>当你需要控制对对象的访问时；当你需要在访问对象前后执行额外操作时；或者当你需要一个对象的简化版本或替代品时。
                                </p>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">常见代理类型</h3>
                            <div class="space-y-3 mb-6">
                                <div class="flex items-start">
                                    <div class="bg-green-100 text-green-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-lock text-xs"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">保护代理</p>
                                        <p class="text-gray-600 text-sm">控制对原始对象的访问权限</p>
                                    </div>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-green-100 text-green-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-cloud text-xs"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">远程代理</p>
                                        <p class="text-gray-600 text-sm">为位于不同地址空间的对象提供本地代表</p>
                                    </div>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-green-100 text-green-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-spinner text-xs"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium">虚拟代理</p>
                                        <p class="text-gray-600 text-sm">延迟创建开销大的对象</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">代码示例</h3>
                            <div class="code-block rounded-lg overflow-hidden mb-4">
                                <pre class="text-gray-200 p-4 text-sm overflow-x-auto">
                                    <code>
// 真实对象接口
public interface RealSubject {
    void request();
}

// 真实对象实现
public class RealSubjectImpl implements RealSubject {
    public void request() {
        System.out.println("Real request");
    }
}

// 代理类
public class Proxy implements RealSubject {
    private RealSubject realSubject;
    public Proxy(RealSubject realSubject) {
        this.realSubject = realSubject;
    }
    public void request() {
        System.out.println("Proxy before request");
        realSubject.request();
        System.out.println("Proxy after request");
    }
}
                                    </code>
                                </pre>
                            </div>
                            <div class="flex items-center text-gray-600 text-sm">
                                <i class="fas fa-info-circle mr-2 text-green-500"></i>
                                <span>代理模式与装饰器模式结构相似，但目的不同：代理控制访问，装饰器添加功能。</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Bridge Pattern -->
        <section id="bridge" class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <div class="flex items-center mb-6">
                        <div class="w-14 h-14 rounded-lg bg-indigo-100 flex items-center justify-center mr-4">
                            <i class="fas fa-bridge text-indigo-600 text-2xl"></i>
                        </div>
                        <h2 class="serif text-3xl font-bold text-gray-800">桥接模式 (Bridge Pattern)</h2>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">核心概念</h3>
                            <p class="text-gray-700 mb-4">
                                桥接模式将抽象部分与实现部分分离，使它们可以独立变化。它通过组合而不是继承来连接抽象和实现，解决了多层次继承带来的类爆炸问题。
                            </p>
                            <div class="bg-indigo-50 border-l-4 border-indigo-500 p-4 rounded mb-6">
                                <p class="text-indigo-800">
                                    <span class="font-semibold">适用场景：</span>当你需要在抽象和实现之间有更灵活的绑定；当抽象和实现都应该通过子类化进行扩展时；或者当实现的变化不应该影响客户端代码时。
                                </p>
                            </div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">结构解析</h3>
                            <div class="mb-6">
                                <div class="flex items-start mb-3">
                                    <div class="bg-indigo-100 text-indigo-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-cube text-xs"></i>
                                    </div>
                                    <p class="text-gray-700"><span class="font-medium">Abstraction</span> - 定义抽象接口，维护对实现对象的引用</p>
                                </div>
                                <div class="flex items-start mb-3">
                                    <div class="bg-indigo-100 text-indigo-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-cubes text-xs"></i>
                                    </div>
                                    <p class="text-gray-700"><span class="font-medium">RefinedAbstraction</span> - 扩展抽象接口，提供更多功能</p>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-indigo-100 text-indigo-800 rounded-full w-6 h-6 flex items-center justify-center mr-3 flex-shrink-0">
                                        <i class="fas fa-microchip text-xs"></i>
                                    </div>
                                    <p class="text-gray-700"><span class="font-medium">Implementor</span> - 定义实现类的接口，通常与抽象类接口不同</p>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-3 text-gray-800">代码示例</h3>
                            <div class="code-block rounded-lg overflow-hidden mb-4">
                                <pre class="text-gray-200 p-4 text-sm overflow-x-auto">
                                    <code>
// 实现接口
public interface Implementation {
    void operation();
}

// 具体实现
public class ConcreteImplementationA implements Implementation {
    public void operation() {
        System.out.println("ConcreteImplementationA operation");
    }
}

// 抽象接口
public abstract class Abstraction {
    protected Implementation implementation;
    public Abstraction(Implementation implementation) {
        this.implementation = implementation;
    }
    public abstract void operation();
}

// 具体抽象
public class RefinedAbstraction extends Abstraction {
    public RefinedAbstraction(Implementation implementation) {
        super(implementation);
    }
    public void operation() {
        implementation.operation();
    }
}
                                    </code>
                                </pre>
                            </div>
                            <div class="flex items-center text-gray-600 text-sm">
                                <i class="fas fa-info-circle mr-2 text-indigo-500"></i>
                                <span>桥接模式是设计模式中最难理解的模式之一，但一旦掌握，它能够显著提升系统的可扩展性和灵活性。</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section class="mb-16">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <h2 class="serif text-3xl font-bold mb-8 text-gray-800 text-center">四种模式对比分析</h2>
                    
                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">模式</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">目的</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">关系方式</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">适用场景</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-10 w-10 bg-purple-100 rounded-lg flex items-center justify-center">
                                                <i class="fas fa-layer-group text-purple-600"></i>
                                            </div>
                                            <div class="ml-4">
                                                <div class="text-sm font-medium text-gray-900">装饰器</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">动态添加功能</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">同接口包装</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">运行时扩展对象功能</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-10 w-10 bg-blue-100 rounded-lg flex items-center justify-center">
                                                <i class="fas fa-exchange-alt text-blue-600"></i>
                                            </div>
                                            <div class="ml-4">
                                                <div class="text-sm font-medium text-gray-900">适配器</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">接口转换</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">不同接口转换</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">使不兼容接口协同工作</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-10 w-10 bg-green-100 rounded-lg flex items-center justify-center">
                                                <i class="fas fa-shield-alt text-green-600"></i>
                                            </div>
                                            <div class="ml-4">
                                                <div class="text-sm font-medium text-gray-900">代理</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">控制访问</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">同接口控制</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">访问控制、延迟加载等</td>
                                </tr>
                                <tr>
                                    <td class="px-6 py-4 whitespace-nowrap">
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-10 w-10 bg-indigo-100 rounded-lg flex items-center justify-center">
                                                <i class="fas fa-bridge text-indigo-600"></i>
                                            </div>
                                            <div class="ml-4">
                                                <div class="text-sm font-medium text-gray-900">桥接</div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">分离抽象与实现</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">组合关联</td>
                                    <td class="px-6 py-4 text-sm text-gray-500">避免多层次继承，独立变化</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="mb-16">
            <div class="bg-gradient-to-r from-blue-50 to-purple-50 rounded-xl shadow-lg overflow-hidden hover-scale">
                <div class="p-8">
                    <h2 class="serif text-3xl font-bold mb-6 text-gray-800">总结与关键要点</h2>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800">核心原则</h3>
                            <div class="space-y-4">
                                <div class="flex items-start">
                                    <div class="bg-white p-2 rounded-lg shadow-sm mr-4 flex-shrink-0">
                                        <i class="fas fa-puzzle-piece text-blue-500"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium text-gray-800">组合优于继承</p>
                                        <p class="text-gray-600 text-sm">这些模式都体现了优先使用对象组合而非类继承的原则，提供了更大的灵活性。</p>
                                    </div>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-white p-2 rounded-lg shadow-sm mr-4 flex-shrink-0">
                                        <i class="fas fa-expand-arrows-alt text-purple-500"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium text-gray-800">松耦合设计</p>
                                        <p class="text-gray-600 text-sm">通过分离关注点，减少类之间的直接依赖，提高系统的可维护性和可扩展性。</p>
                                    </div>
                                </div>
                                <div class="flex items-start">
                                    <div class="bg-white p-2 rounded-lg shadow-sm mr-4 flex-shrink-0">
                                        <i class="fas fa-lock-open text-green-500"></i>
                                    </div>
                                    <div>
                                        <p class="font-medium text-gray-800">开闭原则</p>
                                        <p class="text-gray-600 text-sm">这些模式支持对扩展开放，对修改关闭，允许系统在不修改现有代码的情况下进行扩展。</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800">模式选择指南</h3>
                            <div class="bg-white p-6 rounded-lg shadow-sm">
                                <div class="mermaid">
                                    flowchart TD
                                        A[需要扩展对象功能?] -->|是| B[装饰器模式]
                                        A -->|否| C{接口不兼容?}
                                        C -->|是| D[适配器模式]
                                        C -->|否| E{需要控制访问?}
                                        E -->|是| F[代理模式]
                                        E -->|否| G{抽象与实现需要独立变化?}
                                        G -->|是| H[桥接模式]
                                        G -->|否| I[考虑其他模式]
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-sm">探索编程艺术的殿堂</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition-colors flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i> www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-6 pt-6 text-sm text-center text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```